@extends('main')

@section('tip', '博文列表')

@section('content')
<div class="row">
    <div class="col-md-10 col-md-offset-1">
        @foreach($posts as $post)
        <div class="row">
            <div class="col-md-12">
                <h2>{{ $post->title }}</h2>
                <span style="font-size:12px;color:#aaa">发表于:{{ $post->created_at }}</span>
                <hr>
                    <?php $body = strip_tags($post->body) ?>
                    {!! mb_substr($body, 0, 300) !!}
                    {!! mb_strlen($body)>300?'...':'' !!}
                <p>
                    <a href="{{ route('blog.show', $post->slug) }}" class="btn btn-primary" style="margin-top:20px">阅读博文</a>
                </p>
            </div>
        </div>
        <hr>
        @endforeach
    </div>
    <div class="text-center">
        {!! $posts->render() !!}
    </div>
</div>
@endsection
